package com.add;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


import com.jdbcUtil.*;
import com.jdbcUtil.JDBCUtil;

public class Job1ImplAdd {

	public boolean add(int id, Job1 job) {
		
		Connection conn=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		String sql="insert into jobtype1 (postid, jobtype, jobname,paytype, date, place, salary, notice,jobstate) values (?,?, ?,?,?,?,?,?,?);";
		try{
			conn=JDBCUtil.getConnection();
			ps=JDBCUtil.getStatement(conn, sql);
			ps.setInt(1, id);
			ps.setString(2, job.getJobType());
			ps.setString(3, job.getJobName());
			ps.setString(4, job.getPayType());
			ps.setString(5, job.getWorkTime());
			ps.setString(6, job.getPlace());
			ps.setInt(7, job.getSalary());
			ps.setString(8, job.getNotice());
			ps.setInt(9, job.getState());
			int result=ps.executeUpdate();
			if(result<0){
				return false;
			}
			
		}catch(Exception e){
			System.out.println("Job1ImplAdd.add");
		}
		finally{
			JDBCUtil.free(conn, ps, rs);
		}
		return true;
	}

}
